<?php
class NewsController extends AppController {

	var $name = 'News';
	var $helpers = array('Html', 'Form');
	
	var $paginate = array(
		'limit' => 5,
		'order' => array(
			'News.created' => 'desc'
			)
	);
	
	function beforeFilter() {
		parent::beforeFilter();
		
		$this->Auth->authorize = 'controller';
		$this->Auth->allow('index');
	}
	
	function isAuthorized() {
		/*if( $this->action == 'admin_only' ) {
			if($this->Auth->user('role') != 'a') {
				return false;
			}
			else {
				return true;
			}
		}*/
	}
	
	/**
	 * Muestra noticias
	 */
	function index() {
		$this->pageTitle = 'Avisos & Noticias';
		
		$news = $this->paginate('News');
		$this->set('news', $news);
	}
}
?>